﻿@using Resources
@using QAS.Nekorama.Common
@if (Request.IsAuthenticated)
{
    <li>
        <a title="@QAS_Nekorama.PERSONAL_PAGE" href="@Url.Action("Details", "User", new {id = @WebSecurity.CurrentUserId, questionPage = 1, answerPage = 1})">
            <img src="/Images/Avatars/@Helper.GetUserInfo(WebSecurity.CurrentUserId).Avatar" style="border-radius: 5px; width: 30px;" /></a>
        <ul class="ava-menu">
            <li>
                <a title="@QAS_Nekorama.PERSONAL_PAGE" href="@Url.Action("Details", "User", 
                    new {id = @WebSecurity.CurrentUserId, questionPage = 1, answerPage = 1})">
                    @User.Identity.Name (@Helper.GetReputation(User.Identity.Name))
                </a>
            </li>
            <li>
                @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new {id = "logoutForm"}))
                {
                    @Html.AntiForgeryToken()
                    <a href="javascript:document.getElementById('logoutForm').submit()">@QAS_Nekorama.LOG_OUT</a>
                }
            </li>
        </ul>
    </li>
}
else
{
    <li>
        @using (Html.BeginForm("ExternalLogin", "Account", new {ViewBag.ReturnUrl, provider = "google"}, FormMethod.Post, new {@id = "loginForm"}))
        {
            @Html.AntiForgeryToken()
            <a href="javascript:document.getElementById('loginForm').submit();" 
                title="@QAS_Nekorama.LOG_IN_USING_GOOGLE">
                <img src="~/Images/login-btn.png" style="border-radius: 5px;" /></a>
        }
    </li>
}
<script type="text/javascript">
    $("#login-content").hide();
    $('#login-trigger').click(function() {
        $(this).next('#login-content').slideToggle();
        $(this).toggleClass('active');
        if ($(this).hasClass('active')) $(this).find('span').html('&#x25B2;');
        else $(this).find('span').html('&#x25BC;');
    });
</script>